﻿using AllInOne.Classes;
using HY.Common;
using PropertyChanged;
using System.Windows;
using System.Windows.Controls;

namespace AllInOne.Controls
{
    /// <summary>
    /// SetLocal.xaml 的交互逻辑
    /// </summary>
    [AddINotifyPropertyChangedInterface]
    public partial class SetLocal : UserControl
    {
        public SetLocal()
        {
            InitializeComponent();
            DataContext = this;
        }
        public int SendCardModel { get; set; } = SystemParam.SendCardModel;

        public string ApiUrl { get; set; } = INIHelper.Read("ALL", "ApiUrl");

        public string MainTitle { get; set; } = SystemParam.MainTitle;

        public int TestPage { get; set; } = SystemParam.TestPage;

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            SystemParam.MainTitle = MainTitle;
            SystemParam.SendCardModel = SendCardModel;
            SystemParam.TestPage = TestPage;

            INIHelper.Write("ALL", "SendCardModel", SendCardModel.ToString());
            INIHelper.Write("ALL", "ApiUrl", ApiUrl);
            INIHelper.Write("ALL", "MainTitle", MainTitle);
            INIHelper.Write("ALL", "TestPage", TestPage.ToString());
            
            HandyControl.Controls.Growl.Info("保存成功");
        }
    }
}
